/*
      ::: ::: :::             ::: :::             :::
     :+: :+:   :+:           :+:   :+:           :+:
    +:+ +:+     +:+         +:+     +:+         +:+
   +#+ +#+       +#+       +#+       +#+       +#+
  +#+ +#+         +#+     +#+         +#+     +#+
 #+# #+#           #+#   #+#           #+#   #+#
### ###             ### ###             ### ###

| AHOY WORLD |

nostatics.sqf - Make sure no player can deploy statics in base (Helps prevent griefing)

*/
private ["_v","_veh"];														// set _v for this client only (private)


sdisallowed = ["B_static_AA_F","B_static_AT_F","B_Mortar_01_F","B_HMG_01_high_F","B_HMG_01_F","B_HMG_01_A_F","B_GMG_01_high_F","B_GMG_01_F","B_GMG_01_A_F"];

_veh = _this select 0;


while {true} do {
	waitUntil {sleep 0.5; alive player};									// wait till player is alive
	if (vehicle player in list Base) then {
		while {alive player} do	{											// as long as player is alive
			waitUntil {sleep 0.5; vehicle player != player};				// wait till player enters a vehicle
			svehname = typeOf vehicle player;							// Get vehicle classname of current vehicle
			_v = vehicle player;											// SET _v as the vehicle the player is in
			_unitname = vehicleVarName _v;
			_seats = [driver _v];
			_seats = _seats + [_v turretUnit [0]];
			if ( svehname in sdisallowed ) then {						// if the vehicle is in the dis-allowed list
				if (player in _seats) then {								// if player is seats of that vehicle
					_v addeventhandler ["fired",{  if (vehicle (_this select 0) in list base ) then {deleteVehicle (_this select 6)};}];
					player action ["Eject", _v];							// eject player
					waitUntil {sleep 0.5; vehicle player == player};		// wait till player is booted out of the vehicle
					deletevehicle _v;
					hint "Static emplacements cannot be deployed inside the base!";						// message on screen
				};
			};
		};
	} else {																// if player is not pilot
		waitUntil {sleep 0.5; !alive player};								// Wait till player is alive
	};
};